<include file="./admin-header" />

	<!-- BEGIN PAGE -->
	<div class="page-content">
		<!-- BEGIN PAGE HEADER-->
		<div class="row">
			<div class="col-md-12">
				<!-- BEGIN PAGE TITLE & BREADCRUMB-->
				<h3 class="page-title">
					{$Think.lang.text_area_management} <small>{$Think.lang.text_area_management_tips_en}</small>
				</h3>
				<ul class="page-breadcrumb breadcrumb">
					<li>
						<i class="fa fa-home"></i>
						<a href="{:U('Index/index')}">{$Think.lang.text_home}</a> 
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="{:U('Config/group')}">{$Think.lang.text_system}</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li><a href="{:U('index')}">{$Think.lang.text_area_management}</a></li>
				</ul>
				<!-- END PAGE TITLE & BREADCRUMB-->
			</div>
		</div>
		<!-- END PAGE HEADER-->
		<!-- BEGIN PAGE CONTENT-->          
		<div class="row">
			<div class="col-md-12">
				<!-- BEGIN SAMPLE TABLE PORTLET-->
				<div class="portlet box blue">
					<div class="portlet-title">
						<div class="caption"><i class="fa fa-globe"></i>{$Think.lang.text_area_lists}</div>
						<div class="tools">
							<a href="javascript:;" class="collapse"></a>
							<a href="javascript:;" class="reload"></a>
						</div>
					</div>
					<div class="portlet-body">
						<div class="table-toolbar">
							<div class="btn-group">
								<div class="col-md-4">
									<form name="addForm" id="addForm" action="{:U('insert')}" method="post">
									<input type="hidden" name="parentid" value="{$parentid}" />
									<input type="hidden" name="region_type" value="{$region_type}" />
									<div class="input-group">
										<input type="text" name="region_name" class="form-control" />
										<span class="input-group-btn">
										<button class="btn blue" name="dosubmit" type="submit">{$addInfo}</button>
										</span>
									</div>
									</form>
									<!-- /input-group -->
								</div>
							</div>
						</div>
						<div class="table-responsive">
							<form name="myform" id="myform" action="{:U('listorder')}" method="post" class="form-horizontal">
							<table class="table table-striped table-bordered table-hover">
								<thead>
									<tr>
										<th style="text-align:center" colspan="3">
										<!-- <if condition="!empty($parentid)"> -->[ {$region_name} ]<!-- </if> --> {$areaInfo}</th>
									</tr>
								</thead>
								<tbody>
									<!-- <volist name="list" id="vo"> -->
									<tr>
										<td><input type="text" name="sort_order[{$vo['id']}]" class="form-control input-xsmall" value="{$vo['sort_order']}" /></td>
										<td><input type="text" name="name_{$vo['id']}" id="name_{$vo['id']}" class="form-control input-small" value="{$vo['region_name']}" /></td>
										<td>
											<lt name="region_type" value="3">
												<a href="{:U('index',array('parentid'=>$vo['id']))}" class="btn btn-xs green btn-editable">
													<i class="fa fa-cogs"></i> {$Think.lang.button_manage}</a>
											</lt>
											<a href="javascript:;" onclick="editArea('{$vo[id]}')" class="btn btn-xs yellow btn-editable">
												<i class="fa fa-pencil"></i> {$Think.lang.button_edit}</a> 
											<a href="javascript:;" class="btn btn-xs red btn-removable" onclick="confirm_delete('{:U('delete',array('id'=>$vo['id']))}');">
												<i class="fa fa-times"></i> {$Think.lang.button_delete}</a> 
										</td>
									</tr>
									<!-- </volist> -->
								</tbody>
							</table>
							<!-- <if condition="!empty($list)"> -->
							<div class="table-toolbar">
								<div class="btn-group">
									<button type="submit" name="dosubmit" id="sample_editable_1_new" class="btn blue">
									{$Think.lang.button_listorder} <i class="fa fa-sort"></i>
									</button>
								</div>
								<!-- <if condition="!empty($region_type)"> -->
								<div class="btn-group">
									<button type="button" id="sample_editable_1_new" class="btn default" onclick="javascript:history.back(-1);">
									{$Think.lang.text_back_higher_level} <i class="fa fa-reply"></i>
									</button>
								</div>
								<!-- </if> -->
							</div>
							<!-- </if> -->
							</form>
						</div>
					</div>
				</div>
				<!-- END SAMPLE TABLE PORTLET-->
			</div>
		</div>
		<!-- END PAGE CONTENT-->
	</div>
	<!-- END PAGE -->
	<include file="./admin-js" />    
	<script>
		jQuery(document).ready(function() {
		   App.init();
		});
		function editArea(id){
			var region_name = document.getElementById('name_'+id).value;
	     	var datas = {id:id,region_name:region_name};
	     	$.ajax({
	     		url:"{:U('editArea')}",
	     		data:datas,
	     		type:'POST',
	     		dataType:'json',
	     		success: function(result){
	     			art.dialog.tips(result.info);
	     			setTimeout(function(){ 
	     				window.location.href = "{:U('Area/index',array('parentid'=>$parentid,'region_type'=>$region_type))}";},1000);
	     		},
	     		error: function(result){alert(result.info);}
	     	});
		}
	</script>

<include file="./admin-footer" />